/*
 * @Author       : liumour @3d3-Studio
 * @Date         : 2021-02-04 12:05:32
 * @LastEditTime : 2021-03-03 12:19:13
 * @----------------------------------
 * @FilePath     : \Pro_Ui\src\pages\profile\query_form.js
 * @Description  : 
 */
import React, { useState } from 'react';
import { Row, Col, Form, Input, Button, Checkbox, AutoComplete, Space,DatePicker } from 'antd';

import { DownOutlined, UpOutlined } from '@ant-design/icons';
import df from '../../../config/dataFormat';
import com from '../../utils/common';


export default (props) => {
  const { onFinish, def,reset } = props;
  const [show, setShow] = useState(false)
  const [form] = Form.useForm();

  return (
    <Form
      form={form}
      name="basic"
      size="small"
      initialValues={def}
      layout="inline"
      style={{ position: "absolute", width: "100%", overflow: "hidden", zIndex: 99, height: show ? '138px' : '46px', background: "#fff", border: "1px solid #eee", padding: "10px" }}
      onFinish={(e)=>{
        onFinish(e)
        setShow(false)
      }}
    >
      <Row>
        <Col>
          <Form.Item
            label="辖区"
            name="辖区"
          >
            <AutoComplete
              allowClear
              style={{ width: 90 }}
              options={df.manage_op}
              filterOption={(inputValue, option) =>
                option.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
              }
            />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="姓名"
            name="姓名"
          >
            <Input allowClear style={{ width: 90 }} />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="性别"
            name="性别"
          >
            <AutoComplete
              allowClear
              style={{ width: 60 }}
              options={[{ value: "男" }, { value: '女' }]}
              filterOption={(inputValue, option) =>
                option.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
              }
            />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="身份证号"
            name="身份证号"
          >
            <Input allowClear style={{ width: 150 }} />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="电话号码"
            name="电话号码"
          >
            <Input allowClear style={{ width: 120 }} />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="数据来源"
            name="数据来源"
          >
            <AutoComplete
              allowClear
              style={{ width: 100 }}
              options={df.data_op}
              filterOption={(inputValue, option) =>
                option.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
              }
            />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item >
            <Space>
              <Button onClick={() => {
                console.log('object')
                
                reset()
                setTimeout(() => {
                  form.resetFields()
                  form.submit()
                }, 100);
              }}>
                重置
        </Button>
              <Button type="primary" htmlType="submit">
                查询
        </Button>
            </Space>
          </Form.Item>
        </Col>
        <Col>
          <Form.Item >
            <a
              style={{
                fontSize: 12,
              }}
              onClick={() => {
                setShow(!show);
              }}
            >
              {show ? <UpOutlined /> : <DownOutlined />} 更多条件
          </a>
          </Form.Item>
        </Col>
      </Row>
      <Row style={{ marginTop: "10px" }}>
        <Col>
          <Form.Item
            label="户籍地址"
            name="户籍地址"
          >
            <Input allowClear style={{ width: 150 }} />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="实际居住地"
            name="实际居住地"
          >
            <Input allowClear style={{ width: 150 }} />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="健康状况"
            name="健康状况"
          >
            <Input allowClear style={{ width: 100 }} />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="来玉时间"
            name="来玉时间"
          >
            <DatePicker style={{ width: 120 }} />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="离玉时间"
            name="离玉时间"
          >
            <DatePicker style={{ width: 120 }} />
          </Form.Item>
        </Col>
       
      </Row>
      <Row style={{ marginTop: "10px" }}>
      <Col>
          <Form.Item
            label="录入时间"
            name="录入时间"
          >
            <DatePicker style={{ width: 120 }} />
          </Form.Item>
        </Col>
      <Col>
          <Form.Item
            label="是否下发乡镇跟进"
            name="是否下发乡镇跟进"
          >
            <AutoComplete
              allowClear
              style={{ width: 100 }}
              options={[{ value: "待处理" }, { value: '已发乡镇跟进' }]}
              filterOption={(inputValue, option) =>
                option.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
              }
            />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="管控状态"
            name="管控状态"
          >
            <AutoComplete
              allowClear
              style={{ width: 100 }}
              options={[{ value: "待核查" }, { value: '管控中' }, { value: '已过管控期' }]}
              filterOption={(inputValue, option) =>
                option.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
              }
            />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="核查情况"
            name="核查情况"
            valuePropName="checked"
          >
            <Checkbox />
          </Form.Item>
        </Col>
        <Col>
          <Form.Item
            label="备注"
            name="备注"
            valuePropName="checked"
          >
            <Checkbox />
          </Form.Item>
        </Col>
      </Row>
    </Form>
  );
};
